$(function () {
	layui.use(['jquery','table','layer'],function () {
		let $ = layui.jquery;
		let layer = layui.layer;
		$.ajax({
			url: '/cpu/static',
			type: 'get',
			success: function (data) {
				$('#cpuVendor').text(data.cpuVendor);
				$('#cpuName').text(data.cpuName);
				$('#cpuFamily').text(data.cpuFamily);
				$('#logicalCoreNum').text(data.logicalCoreNum);
				$('#physicalCoreNum').text(data.physicalCoreNum);
				$('#cpuModel').text(data.cpuModel);
				$('#cpuStepping').text(data.cpuStepping);
				$('#cpuVendorFreq').text((data.cpuVendorFreq / 1E9).toFixed(2) + " GHz");
				$('#cpuMaxFreq').text((data.cpuMaxFreq / 1E9).toFixed(2) + " GHz");
			},
			error: function () {
				layer.msg("出错了");
			}
		});
		function loopGetMessage() {
			$.ajax({
				url: '/cpu/dynamic',
				type: 'get',
				success: function (data) {
					$('#cpuUsage').text((data.cpuUsage * 100).toFixed(2) + ' %');
				}
			});
		}
		loopGetMessage();
		setInterval(loopGetMessage,2000);
	});
});